package com.glsc.ngateway.common.base.domain.mysql.gateway.other;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.glsc.ngateway.common.api.common.utils.CommonUtils;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author zhouzp
 * @date 2020/5/29
 * 产品干系人，如总负责人、投资经办、市场经理、市场经办、承揽人，以及部门信息如承揽部门、规模归属部门、收入归属部门
 */
@MappedSuperclass
public class BaseProductRelation implements Serializable {

    private static final long serialVersionUID = 6252209086840535597L;

    //一个产品同一个类型可以有多个选项
    @ApiModelProperty(value = "产品系统编码 prod_id")
    @Column(name = "prod_id", columnDefinition = "INT(11) COMMENT '产品系统编码'")
    protected Integer prodId;

    //一个产品同一个类型可以有多个选项
    @ApiModelProperty(value = "数字证书ID key_id")
    @Column(name = "key_id", columnDefinition = "INT(11) COMMENT '数字证书ID'")
    protected Integer keyId;

    @ApiModelProperty(value = "产品系列ID series_id")
    @Column(name = "series_id", columnDefinition = "INT(11) COMMENT '产品系列ID'")
    protected Integer seriesId;

    //idCertificate身份证明材料-字典 id_certificate_type,其它身份证明材料：字典 other_id_certificate_type
    @ApiModelProperty(value = "产品关联信息类型： 字典 am_prod_relation_type(INVEST_MANAGER 投资经理，INVEST_ASSISTANT 投资助理，PERSON_IN_CHARGE 总负责人，INVEST_OPERATOR 投资经办，MARKET_MANAGER 市场经理，PRODUCT_MANAGER 产品经理，CONTRACTOR 承揽人，CONTRACT_DEPARTMENT 承揽人部门，REVENUE_DEPARTMENT 收入归属部门，SCALE_DEPARTMENT 规模归属部门 )")
    @Column(name = "relation_type", columnDefinition = "varchar(50) COMMENT '产品关联信息类型：字典 am_prod_relation_type(INVEST_MANAGER 投资经理，INVEST_ASSISTANT 投资助理，PERSON_IN_CHARGE 总负责人，INVEST_OPERATOR 投资经办，MARKET_MANAGER 市场经理，PRODUCT_MANAGER 产品经理，CONTRACTOR承揽人，CONTRACT_DEPARTMENT 承揽人部门，REVENUE_DEPARTMENT 收入归属部门，SCALE_DEPARTMENT 规模归属部门'")
    protected String relationType = "";

    @ApiModelProperty(value = "干系人ID，人员为员工编码号，部门为部门名称")
    @Column(name = "related_id", columnDefinition = "varchar(50) COMMENT '关联干系人的ID，可能是人、部门、事件的ID，人员为员工编码号，部门为部门名称'")
    protected String relatedId;

    @ApiModelProperty(value = "备注信息")
    @Column(name = "remark", columnDefinition = "varchar(100) COMMENT '备注信息'")
    protected String remark = "";

    @ApiModelProperty(value = "产品分成比例")
    @Column(name = "prod_percent", columnDefinition = "decimal(6,4) COMMENT '产品分成比例'")
    protected BigDecimal prodPercent;

    @ApiModelProperty(value = "投资经理生效日")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "effective_date", columnDefinition = "varchar(10) DEFAULT '' COMMENT '投资经理生效日 yyyy-MM-dd'")
    protected String effectiveDate = "";

    @ApiModelProperty(value = "投资经理生效结束日")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "effective_end_date", columnDefinition = "varchar(10) DEFAULT '' COMMENT '投资经理生效结束日 yyyy-MM-dd'")
    protected String effectiveEndDate = "";

    @ApiModelProperty(value = "关联关系审核确认状态 字典 am_product_relation_audit_status 1-提交待确认，2-已经确认，3-退回待重新提交")
    @Column(name = "audit_status", columnDefinition = "varchar(50) COMMENT '关联关系审核确认状态， 字典 am_product_relation_audit_status 1-提交待确认，2-已经确认，3-退回待重新提交'")
    protected String auditStatus = "";

    @ApiModelProperty(value = "关联关系审核意见")
    @Column(name = "audit_comment", columnDefinition = "varchar(100) COMMENT '关联关系审核意见'")
    protected String auditComment = "";

    @ApiModelProperty(value = "投资经理是否有效标志 字典: am_product_relation_effective_status")
    @Column(name = "invest_manager_effective_status", columnDefinition = "varchar(10) COMMENT '投资经理是否有效标志 字典: am_product_relation_effective_status'")
    protected String investManagerEffectiveStatus = "";

    @ApiModelProperty(value = "删除状态，字典 YesNo:（N=未删除(默认) Y=已删除)")
    @Column(name = "deleted", columnDefinition = "varchar(20) default 'N' COMMENT '删除状态，字典 yesno （N=否(默认) Y=是)'")
    protected String deleted;

    @ApiModelProperty(value = "操作来源")
    @Column(name = "op_source", columnDefinition = "varchar(32) COMMENT '操作来源'")
    protected String opSource;

    @ApiModelProperty(value = "操作动作(增加、修改)")
    @Column(name = "op_action", columnDefinition = "varchar(32) COMMENT '操作动作(增加、修改)'")
    protected String opAction;

    @ApiModelProperty(value = "操作人员ID")
    @Column(name = "op_operator", columnDefinition = "varchar(20) COMMENT '操作人员ID'")
    protected String opOperator;

    @ApiModelProperty(value = "操作时间")
    @Column(name = "op_time", columnDefinition = "datetime comment '操作时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime opTime;

    public Integer getProdId() {
        return prodId;
    }

    public void setProdId(Integer prodId) {
        this.prodId = prodId;
    }

    public String getRelationType() {
        return relationType;
    }

    public void setRelationType(String relationType) {
        this.relationType = relationType;
    }

    public String getRelatedId() {
        return relatedId;
    }

    public void setRelatedId(String relatedId) {
        this.relatedId = relatedId;
    }

    public BigDecimal getProdPercent() {
        return prodPercent;
    }

    public void setProdPercent(BigDecimal prodPercent) {
        this.prodPercent = prodPercent;
    }

    public String getOpSource() {
        return opSource;
    }

    public void setOpSource(String opSource) {
        this.opSource = opSource;
    }

    public String getOpAction() {
        return opAction;
    }

    public void setOpAction(String opAction) {
        this.opAction = opAction;
    }

    public String getOpOperator() {
        return opOperator;
    }

    public void setOpOperator(String opOperator) {
        this.opOperator = opOperator;
    }

    public LocalDateTime getOpTime() {
        return opTime;
    }

    public void setOpTime(LocalDateTime opTime) {
        this.opTime = opTime;
    }

    public String getAuditStatus() {
        return auditStatus;
    }

    public void setAuditStatus(String auditStatus) {
        this.auditStatus = auditStatus;
    }

    public String getAuditComment() {
        return auditComment;
    }

    public void setAuditComment(String auditComment) {
        this.auditComment = auditComment;
    }

    public String getEffectiveDate() {
        return effectiveDate;
    }

    public void setEffectiveDate(String effectiveDate) {
        this.effectiveDate = effectiveDate;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getInvestManagerEffectiveStatus() {
        return investManagerEffectiveStatus;
    }

    public void setInvestManagerEffectiveStatus(String investManagerEffectiveStatus) {
        this.investManagerEffectiveStatus = investManagerEffectiveStatus;
    }

    public String getEffectiveEndDate() {
        return effectiveEndDate;
    }

    public void setEffectiveEndDate(String effectiveEndDate) {
        this.effectiveEndDate = effectiveEndDate;
    }

    public String getDeleted() {
        return deleted;
    }

    public void setDeleted(String deleted) {
        this.deleted = deleted;
    }

    public Integer getKeyId() {
        return keyId;
    }

    public void setKeyId(Integer keyId) {
        this.keyId = keyId;
    }

    public Integer getSeriesId() {
        return seriesId;
    }

    public void setSeriesId(Integer seriesId) {
        this.seriesId = seriesId;
    }

    @Override
    public String toString() {
        return this.getClass().getSimpleName() + "{" + CommonUtils.getFiledString(this) + "}";
    }
}


